/*
 * Copyright 2009-2015 by WWW.KNET.CN  All rights reserved.
 */

package cn.knet.sp.ncrm.modules.customer.analyse.vo;

import java.util.Date;

import cn.knet.sp.ncrm.common.utils.TimeUtils;
import cn.knet.sp.ncrm.modules.customer.visitrecord.entity.VisitRecord;
import cn.knet.sp.ncrm.modules.sys.customerstatus.entity.CustomerStatus;
import cn.knet.sp.ncrm.modules.sys.customerstatusdetail.entity.CustomerStatusDetail;
import cn.knet.sp.ncrm.modules.sys.producttype.entity.ProductType;
import cn.knet.sp.ncrm.modules.sys.user.entity.User;
import cn.knet.sp.ncrm.modules.sys.utils.CustomerUtils;
import cn.knet.sp.ncrm.modules.sys.utils.ProductUtils;
import cn.knet.sp.ncrm.modules.sys.utils.UserUtils;

/**
 * 销售预测对象 继承自VisitRecord
 *
 * @author zhangbin
 * @version 2015 /09/07 14:40:46
 */
public class AnalyseVo extends VisitRecord {

	private CustomerStatus customerStatus;
	private CustomerStatusDetail customerStatusDetail;
	private ProductType productType;
	private User user;
	private String holdTime;//持续时间
	private Date startDate; //开始时间
	private Date endDate; //结束时间
	private int minPercentage; //最小百分比 可等于
	private String[] products; //多个产品 vo传参用
	private String customerName;//潜在代理商名称

	@Override
	public void setCustomerStatusId(String customerStatusId) {
		super.setCustomerStatusId(customerStatusId);
		this.setCustomerStatus(CustomerUtils.getStatus(customerStatusId));
	}

	@Override
	public void setCustomerStatusDetailId(String customerStatusDetailId) {
		super.setCustomerStatusDetailId(customerStatusDetailId);
		this.setCustomerStatusDetail(CustomerUtils.getStatusDetail(customerStatusDetailId));
	}

	@Override
	public void setLastUpdated(Date lastUpdated) {
		super.setLastUpdated(lastUpdated);
		this.setHoldTime(TimeUtils.toDateString(new Date().getTime() - lastUpdated.getTime(), null));
	}


	@Override
	public void setCreateUserId(String createUserId) {
		super.setCreateUserId(createUserId);
		this.setUser(UserUtils.get(createUserId));
	}

	@Override
	public void setTargetProducts(String targetProducts) {
		super.setTargetProducts(targetProducts);
		this.setProductType(ProductUtils.getEntityByValue(targetProducts));
	}

	public CustomerStatus getCustomerStatus() {
		return customerStatus;
	}

	public void setCustomerStatus(CustomerStatus customerStatus) {
		this.customerStatus = customerStatus;
	}

	public CustomerStatusDetail getCustomerStatusDetail() {
		return customerStatusDetail;
	}

	public void setCustomerStatusDetail(CustomerStatusDetail customerStatusDetail) {
		this.customerStatusDetail = customerStatusDetail;
	}

	public ProductType getProductType() {
		return productType;
	}

	public void setProductType(ProductType productType) {
		this.productType = productType;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getHoldTime() {
		return holdTime;
	}

	public void setHoldTime(String holdTime) {
		this.holdTime = holdTime;
	}

	public Date getStartDate() {
		return startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	public int getMinPercentage() {
		return minPercentage;
	}

	public void setMinPercentage(int minPercentage) {
		this.minPercentage = minPercentage;
	}

	public String[] getProducts() {
		return products;
	}

	public void setProducts(String[] products) {
		this.products = products;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}
}
